window.onload = function () {
    initOrder()
}

function initOrder(){
    axios.get("/order/send/findSending").then(resp =>{
        // console.log(resp.data)
        if (resp.data != ""){
            var str = ""
            let info = resp.data
            info.forEach(n =>{
                str += `<tr>
<td>${n.id}</td><td>${n.money}</td><td>${n.status}</td><td>${n.date}</td><td><a href="javascript:changeStatus(${n.id})">结账</a></td>
</tr>`
            })
            $('sendOrder').innerHTML = str
        }
    })
}

function changeStatus(orderId){
    axios.get("/order/send/changeStatus",{
        params:{orderId}
    }).then(resp =>{
        if (resp.data == "ok"){
            alert("订单完成!")
            initOrder()
        }
    })
}